/**
 *
 */
package com.sb.crawler;

import com.sb.controller.SBController;
import com.sb.crawler.impl.ZheJiangZW;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * @author
 */
@Service
public class ActionTriggerServiceFactory implements ApplicationContextAware {
    private  final Logger logger= LoggerFactory.getLogger(ActionTriggerServiceFactory.class);
    private ApplicationContext applicationContext;

    private Map<String, BaseCrawler> serviceMap;

    public BaseCrawler getTriggerService(String name) {
        BaseCrawler service = null;
        if ("HangZhou".equals(name)) service = new ZheJiangZW("330100");
        else if ("HangZhouXiaoShan".equals(name)) service = new ZheJiangZW("330109");
        else if ("HangZhouYuHang".equals(name)) service = new ZheJiangZW("330110");
        else if ("HangZhouTongLu".equals(name)) service = new ZheJiangZW("330122");
        else if ("HangZhouChunAn".equals(name)) service = new ZheJiangZW("330127");
        else if ("HangZhouJianDe".equals(name)) service = new ZheJiangZW("330182");
        else if ("HangZhouFuYang".equals(name)) service = new ZheJiangZW("330183");
        else if ("HangZhouLingAn".equals(name)) service = new ZheJiangZW("330185");
        return service;
    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        this.applicationContext = applicationContext;
    }

}
